package com.nbsaas.boot.store.rest.convert;

import com.nbsaas.boot.store.data.entity.StorePay;
import com.nbsaas.boot.store.api.domain.simple.StorePaySimple;

import com.nbsaas.boot.rest.api.Converter;

/**
* -列表对象转换器
*/

public class StorePaySimpleConvert implements Converter<StorePaySimple, StorePay> {




@Override
public StorePaySimple convert(StorePay source) {
    StorePaySimple result = new StorePaySimple();


               try {
                   if(source.getShop()!=null){
                       result.setShop(source.getShop().getId());
                   }
                } catch (Exception ignored) { }

                result.setOriginalPrice(source.getOriginalPrice());

                try {
                    if(source.getShop()!=null){
                        result.setShopName(source.getShop().getName());
                    }
                } catch (Exception ignored) { }


               try {
                   if(source.getStore()!=null){
                       result.setStore(source.getStore().getId());
                   }
                } catch (Exception ignored) { }

                result.setBackMoney(source.getBackMoney());
                result.setAddDate(source.getAddDate());

                try {
                    if(source.getCustomer()!=null){
                        result.setCustomerName(source.getCustomer().getName());
                    }
                } catch (Exception ignored) { }

                result.setPayMoney(source.getPayMoney());
                result.setDeduction(source.getDeduction());

                try {
                    if(source.getStore()!=null){
                        result.setStoreName(source.getStore().getName());
                    }
                } catch (Exception ignored) { }

                result.setId(source.getId());

               try {
                   if(source.getCustomer()!=null){
                       result.setCustomer(source.getCustomer().getId());
                   }
                } catch (Exception ignored) { }

                result.setLastDate(source.getLastDate());


    return result;
}

}